package com.wfh.easychat.model.enums;

import cn.hutool.core.util.ObjectUtil;
import io.netty.handler.codec.string.StringDecoder;
import lombok.Getter;

/**
 * @Title: GroupJoinTypeEnum
 * @Author wangfenghuan
 * @Package com.wfh.easychat.model.enums
 * @Date 2025/10/1 16:19
 * @description: 群组加入类型枚举
 */
@Getter
public enum GroupJoinTypeEnum {

    /**
     * 群组加入类型枚举
     */
    DIRECT("直接加入", 0),
    AGREE("管理员同意之后加入", 1);

    GroupJoinTypeEnum(String desc, Integer value) {
        this.desc = desc;
        this.value = value;
    }

    private String desc;
    private Integer value;

    public static GroupJoinTypeEnum getEnumByValue(Integer value) {
        if (ObjectUtil.isEmpty(value)) {
            return null;
        }
        for (GroupJoinTypeEnum groupJoinTypeEnum : GroupJoinTypeEnum.values()) {
            if (groupJoinTypeEnum.value.equals(value)) {
                return groupJoinTypeEnum;
            }
        }
        return null;
    }

}
